horizon=40;
f2=figure('Name','Figure 2. Baseline Model: Impulse Response Functions','Units','centimeters','Position',[5 5 18.5 26]);
for j1 = 1:n_var
        for shock=1:no_str; 
        sIRF_star = sort(irfstr(:,shock,:,:),4);
        
        subplot(n_var,no_str,(j1-1)*no_str+shock);
        irf1=plot(1:horizon, squeeze(prctile(irfstr_cum(j1,shock,1:horizon,:),50,4)),'--g'); hold on;
        irf2=plot(1:horizon, squeeze(prctile(irfstr_cum(j1,shock,1:horizon,:),16,4)),': r'); hold on;
        irf3=plot(1:horizon, squeeze(prctile(irfstr_cum(j1,shock,1:horizon,:),84,4)),': r'); hold on;
        irf5=plot(1:horizon, squeeze(irfstr_cum_mean(j1, shock, 1:horizon)),'-b');
        
        % Same axis height for price; GDP and rent-to price ratio
        if j1<4
             miny=min(min(min(squeeze(prctile(irfstr_cum(j1,1:no_str,1:horizon,:),16,4))), min(squeeze(prctile(irfstr_cum(j1,1:no_str,1:horizon,:),84,4)))));
             maxy=max(max(max(squeeze(prctile(irfstr_cum(j1,1:no_str,1:horizon,:),16,4))), max(squeeze(prctile(irfstr_cum(j1,1:no_str,1:horizon,:),84,4)))));
        axis tight
        else
            miny=min(min(squeeze(prctile(irfstr_cum(j1,shock,1:horizon,:),16,4))), min(squeeze(prctile(irfstr_cum(j1,shock,1:horizon,:),84,4))));
            maxy=max(max(squeeze(prctile(irfstr_cum(j1,shock,1:horizon,:),16,4))), max(squeeze(prctile(irfstr_cum(j1,shock,1:horizon,:),84,4))));
        end
         axis([1 horizon miny maxy])        
         if j1==2 || j1==4 
         x1(:,1) = cat(2,[1, 1, 3, 3]); y1 = [miny, maxy, maxy, miny]; colour = 0.68*ones(1,3);
         fill(x1(:,1), y1, colour, 'MarkerSize',10, 'Linewidth',0.01,'LineStyle','--');
         end
         if  j1==5 && shock~=1
         x1(:,1) = cat(2,[1, 1, 3, 3]); y1 = [miny, maxy, maxy, miny]; colour = 0.68*ones(1,3);
         fill(x1(:,1), y1, colour, 'MarkerSize',10, 'Linewidth',0.01,'LineStyle','--');
         end
            if  j1==6 && shock~=3
         x1(:,1) = cat(2,[1, 1, 3, 3]); y1 = [miny, maxy, maxy, miny]; colour = 0.68*ones(1,3);
         fill(x1(:,1), y1, colour, 'MarkerSize',10, 'Linewidth',0.01,'LineStyle','--');
         end
        alpha(0.5)
        box on
        
        
         if j1==1
       title([shockname(1,shock);shockname(2,shock)])
            end
 
           if shock==1
             ylabel([varname(1,j1);varname(2,j1)],'FontSize',10)
           end
        end
end
lh=legend([irf5 irf1  irf3],{'Mean', 'Median' '16th-84th perc.'},'Location','SouthEast','Orientation','Horizontal');      
set(lh,'Position', [0.5 0.02 0.05 0.05]);
legend('boxoff') 
set(gcf, 'Name','Figure 2. Baseline Model: Impulse Response Functions','NumberTitle','off','PaperPositionMode','auto') 
 % Graphs Name and Save
if savepic==1; grtitle=['IRF'];  print(f2,'-dpng','-zbuffer',[outputfolder grtitle]) ; end


